package cc.linker.steplink.crm.commons.lock;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;

/**
 * @Author: CKQ
 * @DateTime: 2020/7/8 9:56
 * @Description: TODO
 */

@Slf4j
@Configuration
public class ReidsLockAutoConfiguration {
    @Bean
    public DistributedRedisLock distributedRedisLock(RedisTemplate redisTemplate){
        LOGGER.info("init Distributed Redis Lock");
        return new DistributedRedisLock(redisTemplate);
    }

    @Bean
    public DistributedRedisLockAspect distributedRedisLockAspect(DistributedRedisLock distributedRedisLock){
        LOGGER.info("init Distributed Redis Lock Aspect");
        return new DistributedRedisLockAspect(distributedRedisLock);
    }
}
